package com.cn.kgc.thymeleaf.service.impl;

import com.cn.kgc.thymeleaf.dao.BillDao;
import com.cn.kgc.thymeleaf.entity.Bill;
import com.cn.kgc.thymeleaf.service.BillService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/**
 * @author love
 */
@Service
@Transactional
public class BillServiceImpl implements BillService {

    @Autowired
    private BillDao billDao;

    /**
     *查询
     * @param param 条件
     * @return
     */
    @Override
    @Transactional(propagation = Propagation.SUPPORTS)
    public List<Bill> findByMap(Map<String, Object> param) {
        return billDao.findByMap(param);
    }

    /**
     * 添加
     * @param bill
     * @return
     */
    @Override
    public Boolean addBill(Bill bill) {
        return billDao.addBill(bill)>0?true:false;
    }

    /**
     * 删除
     * @param code
     * @return
     */
    @Override
    public Boolean deleteBill(Integer code) {
        return billDao.deleteBill(code)>0?true:false;
    }

    /**
     * 修改
     * @param bill
     * @return
     */
    @Override
    public Boolean updateBill(Bill bill) {
        return billDao.updateBill(bill)>0?true:false;
    }
}
